package com.heima.aliyun.enums;

/**
 * @author kanlina
 * @version 1.0
 * @description: 触发敏感词类型
 * @date 2022/8/13 19:37
 */
public enum SensitiveType {
    /**
     * normal-正常文本
     */
    NORMAL("normal",0,"正常文本"),
    /**
     * ad-广告
     */
    AD("ad",2,"广告"),
    /**
     * politics-涉政
     */
    POLITICS("politics",3,"涉政"),
    /**
     * terrorism-暴恐
     */
    TERRORISM("terrorism",4,"暴恐"),

    /**
     * abuse-辱骂
     */
    ABUSE("abuse",5,"辱骂"),

    /**
     * porn-色情
     */
    PORN("porn",6,"色情"),

    /**
     * flood-灌水
     */
    FLOOD("flood",7,"灌水"),
    /**
     * contraband-违禁
     */
    CONTRABAND("contraband",8,"违禁"),
    /**
     * meaningless-无意义
     */
    MEANINGLESS("meaningless",9,"无意义"),
    CUSTOMIZED("customized",10,"自定义"),
    HARMFUL("harmful",11,"不良场景"),

    /**
     *spam-含垃圾信息
     */
    SPAM("spam",1,"含垃圾信息");

    private String status;
    private Integer type;
    private String  message;

    SensitiveType(String status,Integer type,String message) {
        this.status = status;
        this.type = type;
        this.message = message;
    }

    private static final SensitiveType[] VALUES = SensitiveType.values();
    public static Byte matcherType(String status) {
        for (SensitiveType ele : VALUES) {
            if (status.equals(ele.status)) {
                return ele.type.byteValue();
            }
        }
        return SensitiveType.NORMAL.type.byteValue();
    }

    public static String matcherMessage(String status) {
        for (SensitiveType ele : VALUES) {
            if (status.equals(ele.status)) {
                return ele.message;
            }
        }
        return SensitiveType.NORMAL.message;
    }

}
